using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Tool.BaseClass;
using Tool.Model;
using Tool.Utilty;

namespace Tool
{
	public class Config : Form
	{
		private System.ComponentModel.IContainer components = null;

		private Label label2;

		private TextBox tb_css;

		private Label label7;

		private TextBox tb_js;

		private Label label8;

		private TextBox tb_bg;

		private Label label3;

		private TextBox tb_pic;

		private Label label4;

		private TextBox tb_flash;

		private GroupBox groupBox1;

		private Button bt_save;

		private Label lb_msg;

		private ComboBox cb_encoding;

		private Label label1;

		private TextBox tb_fontpath;

		private Label label5;

		public Config()
		{
			this.InitializeComponent();
		}

		private void bt_save_Click(object sender, EventArgs e)
		{
			this.tb_bg.Text.Trim();
			this.tb_css.Text.Trim();
			this.tb_flash.Text.Trim();
			this.tb_js.Text.Trim();
			this.tb_pic.Text.Trim();
			string encoding = this.method_2();
			string fontPath = this.tb_fontpath.Text.Trim();
			string str = "不正确,请以“/”开头和结尾";
			if (this.method_1(this.tb_css, "Css目录" + str) && this.method_1(this.tb_js, "Js目录" + str) && this.method_1(this.tb_bg, "背景目录" + str) && this.method_1(this.tb_pic, "图片目录" + str) && this.method_1(this.tb_flash, "Flash目录" + str) && this.method_1(this.tb_fontpath, "字体图标目录" + str) && this.method_0(this.cb_encoding, "输入的默认编码不支持"))
			{
				GClass27 gClass = GClass28.smethod_1();
				gClass.BackgroundImageFilePath = this.tb_bg.Text.Trim();
				gClass.CssFilePath = this.tb_css.Text.Trim();
				gClass.FlashFilePath = this.tb_flash.Text.Trim();
				gClass.JsFilePath = this.tb_js.Text.Trim();
				gClass.PictureFilePath = this.tb_pic.Text.Trim();
				gClass.Encoding = encoding;
				gClass.FontPath = fontPath;
				this.lb_msg.Text = "保存成功";
				this.lb_msg.ForeColor = System.Drawing.Color.Green;
			}
		}

		private bool method_0(ComboBox comboBox_0, string string_0)
		{
			bool flag = true;
			string a = this.method_2();
			if (!(a == ""))
			{
				if (!GClass38.smethod_2(ref a))
				{
					flag = false;
				}
			}
			else
			{
				flag = false;
			}
			if (!flag)
			{
				this.lb_msg.Text = string_0;
				this.lb_msg.Visible = true;
				this.lb_msg.ForeColor = System.Drawing.Color.Red;
				comboBox_0.Select();
			}
			return flag;
		}

		private bool method_1(TextBox textBox_0, string string_0)
		{
			bool result;
			if (!GClass0.smethod_8(textBox_0.Text.Trim()))
			{
				this.lb_msg.Text = string_0;
				this.lb_msg.Visible = true;
				this.lb_msg.ForeColor = System.Drawing.Color.Red;
				textBox_0.Select();
				result = false;
			}
			else
			{
				this.lb_msg.Text = "";
				result = true;
			}
			return result;
		}

		private void cb_encoding_SelectionChangeCommitted(object sender, EventArgs e)
		{
			this.lb_msg.Text = "";
		}

		private void Config_Load(object sender, EventArgs e)
		{
			GClass27 gClass = GClass28.smethod_1();
			this.tb_bg.Text = gClass.BackgroundImageFilePath;
			this.tb_css.Text = gClass.CssFilePath;
			this.tb_flash.Text = gClass.FlashFilePath;
			this.tb_js.Text = gClass.JsFilePath;
			this.tb_pic.Text = gClass.PictureFilePath;
			this.cb_encoding.Text = gClass.Encoding;
			this.tb_fontpath.Text = gClass.FontPath;
			this.tb_bg.TextChanged += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
			this.tb_css.TextChanged += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
			this.tb_flash.TextChanged += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
			this.tb_js.TextChanged += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
			this.tb_pic.TextChanged += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
			this.tb_fontpath.TextChanged += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
			this.cb_encoding.SelectionChangeCommitted += new EventHandler(this.cb_encoding_SelectionChangeCommitted);
		}

		private string method_2()
		{
			string result;
			if (this.cb_encoding.SelectedItem == null)
			{
				result = this.cb_encoding.Text.Trim();
			}
			else
			{
				result = this.cb_encoding.SelectedItem.ToString().Trim();
			}
			return result;
		}

		private void cb_encoding_MouseHover(object sender, EventArgs e)
		{
			GClass54.Object.method_0(sender, "当系统检测不到网页采用的编码时,直接采用默认编码。\r\n提示：如果下拉菜单中没有你所需的编码，也支持手动输入。");
		}

		private void method_3(object sender, EventArgs e)
		{
			GClass54.Object.method_0(sender, "默认值：无\r\n针对特殊网站，如手机站，它只允许手机用户才能访问，这时需要设置为移动端模拟器。");
		}

		//protected override void vmethod_0(bool bool_0)
		//{
		//	if (bool_0 && this.components != null)
		//	{
		//		this.components.Dispose();
		//	}
		//	base.Dispose(bool_0);
		//}

		private void InitializeComponent()
		{
			System.ComponentModel.ComponentResourceManager componentResourceManager = new System.ComponentModel.ComponentResourceManager(typeof(Config));
			this.label2 = new Label();
			this.tb_css = new TextBox();
			this.label7 = new Label();
			this.tb_js = new TextBox();
			this.label8 = new Label();
			this.tb_bg = new TextBox();
			this.label3 = new Label();
			this.tb_pic = new TextBox();
			this.label4 = new Label();
			this.tb_flash = new TextBox();
			this.groupBox1 = new GroupBox();
			this.tb_fontpath = new TextBox();
			this.label5 = new Label();
			this.cb_encoding = new ComboBox();
			this.label1 = new Label();
			this.lb_msg = new Label();
			this.bt_save = new Button();
			this.groupBox1.SuspendLayout();
			base.SuspendLayout();
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(29, 44);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(47, 12);
			this.label2.TabIndex = 2;
			this.label2.Text = "CSS目录";
			this.tb_css.Location = new System.Drawing.Point(82, 41);
			this.tb_css.Name = "tb_css";
			this.tb_css.Size = new System.Drawing.Size(128, 21);
			this.tb_css.TabIndex = 2;
			this.label7.AutoSize = true;
			this.label7.Location = new System.Drawing.Point(230, 44);
			this.label7.Name = "label7";
			this.label7.RightToLeft = RightToLeft.No;
			this.label7.Size = new System.Drawing.Size(41, 12);
			this.label7.TabIndex = 0;
			this.label7.Text = "JS目录";
			this.tb_js.Location = new System.Drawing.Point(277, 41);
			this.tb_js.Name = "tb_js";
			this.tb_js.Size = new System.Drawing.Size(128, 21);
			this.tb_js.TabIndex = 3;
			this.label8.AutoSize = true;
			this.label8.Location = new System.Drawing.Point(23, 81);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(53, 12);
			this.label8.TabIndex = 0;
			this.label8.Text = "背景目录";
			this.tb_bg.Location = new System.Drawing.Point(83, 78);
			this.tb_bg.Name = "tb_bg";
			this.tb_bg.Size = new System.Drawing.Size(128, 21);
			this.tb_bg.TabIndex = 4;
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(218, 81);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(53, 12);
			this.label3.TabIndex = 0;
			this.label3.Text = "图片目录";
			this.tb_pic.Location = new System.Drawing.Point(277, 78);
			this.tb_pic.Name = "tb_pic";
			this.tb_pic.Size = new System.Drawing.Size(128, 21);
			this.tb_pic.TabIndex = 5;
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(17, 117);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(59, 12);
			this.label4.TabIndex = 0;
			this.label4.Text = "FLASH目录";
			this.tb_flash.Location = new System.Drawing.Point(83, 115);
			this.tb_flash.Name = "tb_flash";
			this.tb_flash.Size = new System.Drawing.Size(128, 21);
			this.tb_flash.TabIndex = 6;
			this.groupBox1.Controls.Add(this.tb_fontpath);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.cb_encoding);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.tb_flash);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.tb_pic);
			this.groupBox1.Controls.Add(this.lb_msg);
			this.groupBox1.Controls.Add(this.tb_bg);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.bt_save);
			this.groupBox1.Controls.Add(this.tb_js);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Controls.Add(this.tb_css);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Location = new System.Drawing.Point(13, 12);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(430, 214);
			this.groupBox1.TabIndex = 3;
			this.groupBox1.TabStop = false;
			this.tb_fontpath.Location = new System.Drawing.Point(277, 117);
			this.tb_fontpath.Name = "tb_fontpath";
			this.tb_fontpath.Size = new System.Drawing.Size(128, 21);
			this.tb_fontpath.TabIndex = 105;
			this.label5.AutoSize = true;
			this.label5.Location = new System.Drawing.Point(218, 120);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(53, 12);
			this.label5.TabIndex = 104;
			this.label5.Text = "字体图标";
			this.cb_encoding.FormattingEnabled = true;
			this.cb_encoding.Items.AddRange(new object[]
			{
				"ASCII",
				"UTF-8",
				"UNICODE",
				"GBK",
				"GB2312",
				"BIG5"
			});
			this.cb_encoding.Location = new System.Drawing.Point(83, 151);
			this.cb_encoding.Name = "cb_encoding";
			this.cb_encoding.Size = new System.Drawing.Size(128, 20);
			this.cb_encoding.TabIndex = 103;
			this.cb_encoding.MouseHover += new EventHandler(this.cb_encoding_MouseHover);
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(24, 153);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(53, 12);
			this.label1.TabIndex = 102;
			this.label1.Text = "默认编码";
			this.lb_msg.AutoSize = true;
			this.lb_msg.ForeColor = System.Drawing.Color.FromArgb(0, 192, 0);
			this.lb_msg.Location = new System.Drawing.Point(176, 191);
			this.lb_msg.Name = "lb_msg";
			this.lb_msg.Size = new System.Drawing.Size(0, 12);
			this.lb_msg.TabIndex = 101;
			this.bt_save.Location = new System.Drawing.Point(82, 183);
			this.bt_save.Name = "bt_save";
			this.bt_save.Size = new System.Drawing.Size(84, 23);
			this.bt_save.TabIndex = 100;
			this.bt_save.TabStop = false;
			this.bt_save.Text = "保存配置";
			this.bt_save.UseVisualStyleBackColor = true;
			this.bt_save.Click += new EventHandler(this.bt_save_Click);
			base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new System.Drawing.Size(464, 238);
			base.Controls.Add(this.groupBox1);
			base.FormBorderStyle = FormBorderStyle.FixedSingle;
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "Config";
			base.Opacity = 0.96;
			base.ShowIcon = false;
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterParent;
			this.Text = "配置";
			base.Load += new EventHandler(this.Config_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			base.ResumeLayout(false);
		}
	}
}
